package com.yc.cangst.service;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yc.cangst.mapper.EbUserMapper;
import com.yc.cangst.model.EbUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class EbUserServiceImpl implements EbUserService {
    @Autowired
    private EbUserMapper ebUserMapper;

    @Override
    public EbUser login(EbUser ebUser) {
        EbUser lgnUser = ebUserMapper.selectOne(Wrappers.<EbUser>lambdaQuery()
                .eq(EbUser::getEuUserId, ebUser.getEuUserId())
                .eq(EbUser::getEuPassword, ebUser.getEuPassword()));

        return lgnUser;

    }

    @Override
    public EbUser register(EbUser ebUser) {
        int result = ebUserMapper.insert(ebUser);
        if (result <= 0) {
            return null;
        }
        return ebUser;

    }
}
